package com.sjyl.kaoshitong.activities;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.Toolbar;
import android.view.View;

import com.sjyl.kaoshitong.BaseActionBarActivity;
import com.sjyl.kaoshitong.R;
import com.sjyl.kaoshitong.fragment.MyDocumentFileListFragment;

/**
 * Created by ChangerLow on 15/6/12.
 * Email: changerlow@qq.com
 */
public class MyDocumentFileListActivity extends BaseActionBarActivity {
    private static String TAG = "MyDocumentFileListActivity";
    private Toolbar toolbar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fragment_container);
        toolbar = getActionBarToolbar();
        toolbar.setTitle(getString(R.string.my_document));
        // getSupportActionBar().setLogo(R.mipmap.ic_launcher);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
                overridePendingTransition(R.anim.push_right_in,R.anim.push_right_out);
            }
        });
        String pid = getIntent().getStringExtra("pid");
        String title = getIntent().getStringExtra("title");
        getSupportActionBar().setTitle(title);
        Fragment fragment = MyDocumentFileListFragment.newInstance(pid,title);
        FragmentTransaction transaction = this.getSupportFragmentManager().beginTransaction();
        transaction.add(R.id.container, fragment);
        transaction.commitAllowingStateLoss();
    }


    @Override
    public void onBackPressed() {
        super.onBackPressed();
        overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out);
    }
}
